package com.liuyz.thread_;

// 实现Runnable接口
public class Runnable_ {

    public static void main(String[] args) {
        new Thread(new Dog()).start();
    }
}

class Dog implements Runnable {

    int nums = 0;

    @Override
    public void run() {
        while (true) {
            System.out.println("一条狗_" + (++nums) + " 线程名：" + Thread.currentThread().getName());
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            if (nums == 8) {
                break;
            }
        }
    }
}
